#!/bin/bash
# SYNOPSIS
#	check_pbsmom [<TCP port>] [<TCP port>] ...
#
# DESCRIPTION
#	This NAGIOS plugin checks whether: 1) pbs_mom is running and
#	2) the host is listening on the given port(s).  If no port
#	number is specified TCP ports 15002 and 15003 are checked.
#
# AUTHOR
#	Wayne.Mallett@jcu.edu.au

OK=0
WARN=1
CRITICAL=2
PATH="/bin:/sbin:/usr/bin:/usr/sbin"


if [ `ps -C  automount| wc -l` -lt 2 ]; then
  echo "Automount CRITICAL:  Daemon is NOT running!"
  exit $CRITICAL
else
  echo "Automount OK:  Daemon is running.  Host is listening."
  exit $OK
fi
